﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace T5._3.Models
{
    public class Product
    {
        public int ID { get; set; }
        //设置名字
        [Display(Name ="姓名")]
        [Required(ErrorMessage ="您需要填写{0}！")]
        [StringLength(50,MinimumLength =2)]
        public string Name { get; set; }

        //设置年龄
        [Display(Name ="年龄")]
        [Range(1,150,ErrorMessage ="年龄填写不正确！")]
        public int Age { get; set; }

        //设置身高
        [Display(Name ="身高")]
        [Range(typeof(decimal),"50.00","250.00",ErrorMessage ="身高超出指点范围！")]
        public decimal Height { get; set; }

        //设置生日
        [Display(Name ="生日")]
        [DataType(DataType.Date)]
        public DateTime Birthday { get; set; }

        //设置邮箱
        [Display(Name ="电子邮箱")]
        [RegularExpression(@"(\w)+(\.\w+)*@(\w)+((\.\w+)+)",ErrorMessage ="{0}格式不正确！")]
        [Required(ErrorMessage = "您需要填写{0}！")]
        public string Email { get; set; }
    }
}